<!--
 * @Author: yuanjunyi
 * @Date: 2024-02-26 14:48:37
 * @LastEditors: yuanjunyi
 * @LastEditTime: 2024-04-22 13:10:28
 * @Description: this is description
-->
<template>
  <div class="advantage" style="width: 66.7%; margin: auto">
    <div v-for="item in advantageDate" :key="item.title">
      <div class="before-hover">
        <span style="display: inline-block">
          <img :src="item.url" alt="" />
          <P>{{ item.title }}</P>
        </span>
      </div>
      <div class="after-hover">
        {{ item.text }}
      </div>
    </div>

    <img :src="imgUrl + 'jcb-advantage.png'" alt="" />
  </div>
</template>
<script lang="ts" setup>
import { imgUrl } from "@/utils/common";
const props = defineProps({
  advantageDate: {
    type: Array,
    default: () => [],
  },
});
</script>
<style lang="scss" scoped>
/* 五大优势 */
.advantage {
  position: relative;
  height: 500px;
  > div {
    position: absolute;
    width: 17%;
    height: 41%;
    box-shadow: 0px 4px 13px 0px rgba(155, 155, 155, 0.15);
    padding: 3px;
    border-radius: 3px;
    &:nth-of-type(2n-1) {
      top: 10%;
    }
    &:nth-of-type(2n) {
      top: 25%;
    }
    &:first-of-type {
      left: 5%;
    }
    &:nth-of-type(2) {
      left: 29%;
    }
    &:nth-of-type(3) {
      left: 53%;
    }
    &:nth-of-type(4) {
      left: 77%;
    }
    &:last-of-type {
      right: 1.5%;
    }
    &:hover .after-hover {
      background: #1678ff;
      background-image: url("https://gggj-fe.oss-cn-hangzhou.aliyuncs.com/steel-mall/advantage-bg.png");
      background-size: cover;
      color: #fff;
    }
    .before-hover {
      display: flex;
      justify-content: center;
      align-items: center;
      text-align: center;
      img {
        margin-bottom: 10px;
      }
      p {
        font-weight: 600;
        font-size: 20px;

        line-height: 23px;
      }
    }
    .after-hover {
      display: none;
      padding: 20px;
      font-weight: 400;
      font-size: 14px;
      line-height: 26px;
    }
    &:hover .before-hover {
      display: none;
    }
    &:hover .after-hover {
      display: block;
    }
    div {
      width: 100%;
      height: 100%;
      background: linear-gradient(181deg, #eff3f9 0%, #ffffff 100%);
      border-radius: 3px;
    }
  }
  > div:after {
    content: "";
    height: 10px;
    position: absolute;
    bottom: -10px;
    left: calc(50% - 10px);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 0 10px;
    border-color: #fff transparent transparent transparent;
  }
  > img {
    margin-top: 280px;
    width: 100%;
  }
}
</style>
